![]() |
PATH![]() |
![]() ![]() |
When you call URLOpen , you may want to specify a notification callback routine to receive information about events that occur during an asynchronous download or upload. This is how you would declare the callback function if you were to name the function MyURLNotifyProc :
OSStatus *MyURLNotifyProcPtr (
void* userContext,
URLEvent event,
URLCallbackInfo *callbackInfo);
The URL Access Manager will call your notification callback routine when events for which your application has registered occur during the asynchronous download or upload of data to a URL. Use the eventRegister parameter to the URLOpen function to specify the events for which you want to receive notification.
If you call URLOpen with a fileSpec parameter that is a valid file specification, the following events can cause the URL Access Manager to call your application's notification callback routine:
kURLPercentEvent kURLPeriodicEvent kURLPropertyChangedEvent kURLSystemEvent kURLInitiatedEvent kURLResourceFoundEvent kURLDownloadingEvent kURLUploadingEvent kURLAbortInitiatedEvent kURLCompletedEvent kURLErrorOccurredEvent
If you call URLOpen with a fileSpec parameter that is NULL and you are downloading from a URL, the following events can cause the URL Access Manager to call your application's notification callback routine:
kURLDataAvailableEvent kURLTransactionCompleteEvent
See Event Constants for a description of each constant.
WARNING
Do not call URLDisposeReference from your notification callback routine. Doing so may cause your application to stop working. Other than this restriction, your application can make any call. For example, your notification callback routine can update its human interface, allocate and deallocate memory, or call NewThread ..